<?php
    function diffbetween2days ($day1,$day2) {
        $sec1 = strtotime($day1);
        $sec2 = strtotime($day2);
        
        if ($sec1 < $sec2) {
            $tmp = $sec2;
            $sec2 = $sec1;
            $sec1 = $tmp;
        }
        return ($sec1 - $sec2)/86400;
    }
    $day1 = $_POST["day1"];
    $day2 = $_POST["day2"];
    $diff = diffbetween2days($day1,$day2);
    echo $diff."\n";
?>
